package com.qidianit.mes.pro.controller;

import com.github.pagehelper.PageInfo;
import com.qidianit.mes.pojo.Result;
import com.qidianit.mes.pojo.pro.Process;
import com.qidianit.mes.pro.service.ProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @Author: wang fei long
 * @Date: 2025/9/17 0017 - 16:16
 */
@RestController
@RequestMapping("/process")
@CrossOrigin
public class ProcessController {
    @Autowired
    private ProcessService processService;
    @GetMapping("/page")
    public Result<PageInfo<Process>> selectAll(Process process, @RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10")int size){
        return processService.selectAll(process,page,size);
    }
    @PostMapping("/add")
    public Result insertProcess(@RequestBody Process process){
        return processService.insertProcess(process);
    }
    @GetMapping("/code/{code}")
    public Result<Process> selectByCode(@PathVariable String code){
        return processService.selectByCode(code);
    }
    @PutMapping("/update")
    public Result updateById(@RequestBody Process process){
        return processService.updateById(process);
    }
    @DeleteMapping("/delete/{id}")
    public Result deleteById(@PathVariable Long id){
        return processService.deleteById(id);
    }
    @DeleteMapping("/batchDelete")
    public Result batchDelete(Long[] id){
        return processService.batchDelete(id);
    }

}
